<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type"content="text/html; charset=utf-8"/>
<title>Security</title>
<link href="index.css"rel="stylesheet"type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>深圳市飞通宽带有限公司</title>
</head>
<body class="bodystyle"  >
<script language="javascript" type="text/javascript">

var xmlhttp;

function loadXMLDoc(url,cfunc)
{  
   	if(window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
  		//针对某些特定的浏览器进行修正
  		if(xmlhttp.overrideMimeType){
   			xmlhttp.overrideMimeType("text/xml");
  		}
	}else if(window.ActiveXObject){
  		//针对ie5，ie5.5，ie6
  		var activexName=["MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
  		for(var i=0;i<activexName.length;i++){
   			try{
    			xmlhttp=new ActiveXObject(activexName[i]);
    			break;
   			}catch (e) {}
  		}
	}
	//确认xmlhttp对象创建成功
	if(!xmlhttp){
		alert("xmlhttprequest 创建失败！");
	}else{

	}
	
	xmlhttp.onreadystatechange=cfunc;
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}

/*****************************************************************
*函数名称  ：changeUsername
*功能描述     改变一个用户名
*输入参数：无
*输出参数：
*返回值：   无
*2016/02/08  wangkang
*******************************************************************
*/
function changUsername() 
{
	var username=document.getElementById("username").value;
	if(username=="")
	{
		alert("input is NULL");
		return;
	}
	
	var parm = "/change_username_setting.cgi?";
	parm+="&new_username="+username;
	parm+="&t=";
	parm+=Math.random();
	loadXMLDoc(parm,function()//不能写成led0=0，因为遇到=号就代表结束
  	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			var ret = xmlhttp.responseText;
			if ( ret != "1" )
			{
				alert ( "Set OK!\r\nNow username is " + ret );
			}
			else
			{
				alert ( "Setting Failed!\r\n" );	
			}
		}
   });
}
/*****************************************************************
*函数名称  ：changePassword
*功能描述     修改密码
*输入参数：无
*输出参数：
*返回值：   无
*2016/02/08  wangkang
*******************************************************************
*/
function  changePassword()
{
	
	var oldpassword=document.getElementById("oldpassword").value;
	var newpassword=document.getElementById("newpassword").value;
	var confirmpassword=document.getElementById("confirmpassword").value;
	
	//alert("ssss"+oldpassword);
	if(oldpassword==""||newpassword==""||confirmpassword=="")
		{alert("please input !!!");return;}
	if(oldpassword==newpassword)
		{alert("new password equal to old's");return;}
	if(newpassword!=confirmpassword)
	 	{alert("tiwice password input is error");return;}
		
	var parm = "/change_password_setting.cgi?";
	parm+="&old_password="+oldpassword;
	parm+="&new_password="+newpassword;
	parm+="&t=";
	parm+=Math.random();
	loadXMLDoc(parm,function()//不能写成led0=0，因为遇到=号就代表结束
  	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			var ret = xmlhttp.responseText;
			alert ( ret );
		}
   });
		
	
}

function checkInputData(e)
{

	var key = window.event ? e.keyCode:e.which;
	
	if ( ! (( key == 95 ) || 
		   	( key >= 48 && key <= 57 ) ||
			( key >= 65 && key <= 90 ) ||
			( key >= 97 && key <= 122 ) ) )
	{        
//		alert("input error!" + "a" );
		
		if (window.event) //IE
		{
			e.returnValue = false;   //event.returnValue=false Ч1?.
		}
		else //Firefox
		{
			e.preventDefault();
		}
	}  
}

</script>
<div style="background-color:#FFF;" >
  <tr align="left">
    <td colspan="2"bgcolor="#FFFFFF"><table border="0"cellpadding="0"cellspacing="0">
        <tr>
          <td align="center" rowspan="2" width="100"><img src="images/Logo.jpg"alt=""width="67"height="62"/></td>
          <td rowspan="2" width="200"><img src="images/photon.gif" alt=""width="95"height="24"/></td>
          <td colspan="2" width="700"class="txtstyle_2"><blockquote>
              <p>TECHNOLOGY CORPORATION</p>
            </blockquote></td>
        </tr>
        <tr>
          <td align="right"class="txtstyle_1">A Lead of HFC Network Equipments Manufacturer</td>
        </tr>
      </table></td>
  </tr>
  <div class="menu">
    <ul class="ul1">
      <!--<li class="li1"><a href="index.html">MainPage</a></li>-->
      <li class="li1"><a href="device.html">Device</a></li>
      <li class="li1"><a href="network.html">Network</a></li>
      <li class="current"><a href="security.html">Security</a></li>
    </ul>
  </div>
</div>
<table width="1000"border="0"align="center"cellpadding="0"cellspacing="0">
  <! 表单1>
  <form name="security_1" >
    <tr>
      <td colspan="2"bgcolor="#EDEFEF"><div class="subitem_1"><strong>Change Username </strong>Setting</div></td>
    </tr>
    <tr>
      <td width="260"bgcolor="#EDEFEF"><div class="item_1">New Username</div></td>
      <td width="530"bgcolor="#EDEFEF"><input name="new_usn"type="text"class="item_2"id="username"style="width: 250px"maxlength="15"onKeypress="checkInputData(event);"/>
        <span id="new_usn_msg"class="errMsg0"></span></td>
    </tr>
    <tr>
      <td colspan="2"bgcolor="#EDEFEF">&nbsp;</td>
    </tr>
    <tr align="center">
      <td colspan="2"bgcolor="#EDEFEF"><input name="new_usn" type="button" class="item_2"style="WIDTH: 60px; HEIGHT: 24px;" onclick="changUsername()" value="Apply"/>
        <input name="Cancel"type="reset"class="item_2"style="WIDTH: 60px; HEIGHT: 24px;"value="Cancel" /></td>
    </tr>
  </form>
  <! 表单 2>
  <form name="security_2"method="POST"onsubmit="return chkForm(1);">
    <tr>
      <td colspan="2"bgcolor="#EDEFEF"><div class="subitem_1"><strong>Change Password </strong>Setting</div></td>
    </tr>
    <tr>
      <td bgcolor="#EDEFEF"><div class="item_1">Old Password</div></td>
      <td bgcolor="#EDEFEF"><input name="old_psw"type="password"class="item_2"style="width: 250px"maxlength="15" id="oldpassword"/>
        <span id="old_psw_msg"class="errMsg0"></span></td>
    </tr>
    <tr>
      <td bgcolor="#EDEFEF"><div class="item_1">New Password</div></td>
      <td bgcolor="#EDEFEF"><input name="new_psw" id="newpassword"type="password"class="item_2"style="width: 250px"maxlength="15"/>
        <span id="new_psw_msg"class="errMsg0"></span></td>
    </tr>
    <tr>
      <td bgcolor="#EDEFEF"><div class="item_1">Confirm Password</div></td>
      <td bgcolor="#EDEFEF"><input name="cfm_psw"type="password"class="item_2"style="width: 250px"maxlength="15" id="confirmpassword"/>
        <span id="cfm_psw_msg"class="errMsg0"></span></td>
    </tr>
    <tr>
      <td colspan="2"bgcolor="#EDEFEF">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2"align="center"bgcolor="#EDEFEF"><input name="Apply"type="button"class="item_2"style="WIDTH: 60px; HEIGHT: 24px;"onclick="changePassword()"value="Apply"/>
        <input name="Cancel"type="reset"class="item_2"style="WIDTH: 60px; HEIGHT: 24px;"value="Cancel" onclick="NchgPasswd()"/></td>
    </tr>
    <tr>
      <td colspan="2"bgcolor="#EDEFEF">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2"bgcolor="#C0C0C0">&nbsp;</td>
    </tr>
  </form>
</table>
<blockquote>&nbsp;</blockquote>
</body>
</html>